﻿using System;
using System.Collections.Generic;
using System.Text;

namespace BCCommon
{
    /// <summary>
    /// 正则
    /// </summary>
    public static class RegexPatterns
    {
        public const string ENGLISH_AND_NUMBER = @"^[a-zA-Z_0-9]+$";
        public const string ENGLISH_LOWER_AND_NUMBER = @"^[a-z_0-9]+$";
        public const string ENGLISH_AND_NUMBER_AND_POINT = @"^[a-zA-Z_0-9\\.\\-]+$";
        /// <summary>
        /// 英文单词和下划线
        /// </summary>
        public const string ENGLISH_AND_UNDERLINE = @"^[a-zA-Z_]+$";
        /// <summary>
        /// 英文单词
        /// </summary>
        public const string ENGLISH = @"^[a-zA-Z]+$";
        /// <summary>
        /// 数字格式
        /// </summary>
        public const string NUMBER = @"^[0-9]*$";

        /// <summary>
        /// 车牌号
        /// </summary>
        public const string PLATE_NUMBER = @"^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领A-Z]{1}[A-Z]{1}[警京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼]{0,1}[A-Z0-9]{4}[A-Z0-9挂学警港澳]{1}$";

        /// <summary>
        /// 邮箱
        /// </summary>
        public const string EMAIL = @"^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$";

        /// <summary>
        /// 中文字符串
        /// </summary>
        public const string CHINESE = @"[\u4e00-\u9fa5]";
        /// <summary>
        /// 域名（支持中文域名,支持纯IPV4地址）
        /// </summary>
        public const string DOMAIN_NAME = @"^((http)|(https))+://((([0-9]{1,3}[.]{1}){3}([0-9]{1,3}){1})|([a-zA-Z0-9.]*((([.]{1}[a-zA-Z]*)+)|((([.]{1}[a-zA-Z0-9]*)*)([.]{1}[\u4e00-\u9fa5]*)))))([:]{1}[0-9]{1,5})?[/]$";
        /// <summary>
        /// Html标签(标签对闭合，会出现不对称闭合)
        /// </summary>
        public const string HTML_TAG_CLOSURE = "((<[\\w]+)+)((((((\\s(\\w)*)*(=\"){1,})|((\\s([a-zA-Z0-9-])*)*(=\"){1,}))\\w.*)(((\\\"))+)?)*)((([>]{1})(((?:\\w)|(?:[^<\\/])|\r|\n)*)((</)(\\w)+[>]))|(\\/[>]{1}))";
        /// <summary>
        /// Html标签（单标签闭合）
        /// </summary>
        public const string HTML_TAG_SINGLE = "((<[\\w]+)+)((((((\\s(\\w)*)*(=\"){1,})|((\\s([a-zA-Z0-9-])*)*(=\"){1,}))\\w.*)(((\"))+)?)*)((\\\">{1})|(\\/[>]{1}))";

        /// <summary>
        /// 邮编
        /// </summary>
        public const string ZIP_CODE = @"[1-9]\d{5}(?!\d)";

        /// <summary>
        /// 身份证
        /// </summary>
        public const string ID_CARD = @"^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}([0-9]|X)$";

        /// <summary>
        ///  手机号
        /// </summary>
        public const string PHONE = @"^1(3|4|5|7|8|9)\d{9}$";

        /// <summary>
        /// 手机号或固定电话
        /// </summary>
        public const string TELEPHONE = @"^(1(3|4|5|7|8|9)\d{9})|([0-9-()（）]{7,18})$";

        /// <summary>
        /// 6位验证码
        /// </summary>
        public const string SIX_PASS_CODE = @"^\d{6}$";

        /// <summary>
        /// 密码
        /// </summary>
        public const string PASSWORD = @"(?!^\d+$)(?!^[a-zA-Z]+$)[0-9a-zA-Z]{8,16}$";

        /// <summary>
        /// MAC地址检测
        /// </summary>
        public const string MAC = @"/^[a-fA-F0-9]{2}(-[a-fA-F0-9]{2}){5}$|^[a-fA-F0-9]{2}(:[a-fA-F0-9]{2}){5}$";
        /// <summary>
        /// 6位支付密码
        /// </summary>
        public const string PAY_PASSWORD = @"^\d{6}$";
        /// <summary>
        /// 字典分类码
        /// </summary>
        public const string DICTIONAY_CATEGORY_CODE = @"^[a-zA-Z]+([_]{1})[a-zA-Z]+$";
        /// <summary>
        /// 图片地址检测
        /// </summary>
        public const string PHOTO_ADDRESS = @"^(https?)((:\/\/)[\w.\/]+)((.png|.jpg|.jpeg|.PNG|.JPG|.JPEG){1})$";
        /// <summary>
        /// 6位收货码
        /// </summary>
        public const string SIX_RECEIVING_CODE = "^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{6}$";
        /// <summary>
        /// 时分秒检测
        /// </summary>
        public const string TIME = "([0-1]?[0-9]|2[0-3]):([0-5][0-9]):([0-5][0-9])$";

    }
}
